<!-- 左侧筛选树 -->
<template>
  <div class="left-tree" :style="{width: (isShowLeftTree ? '0': '18%')}">
    <div class="treeTitle" v-if="!isShowLeftTree">
      电子文件筛选
    </div>
    <div class="treeNode" v-if="!isShowLeftTree">
      <a-tree
        show-line
        :treeData="treeData"
        defaultExpandAll
        v-if="treeData.length > 0">
      </a-tree>
      <a-empty v-else />
    </div>
    <a-button block v-if="!isShowLeftTree">未归档</a-button>
    <div class="handle" @click="treeToggle">
      <img src="@/assets/images/leftTree-show.png" alt="" v-if="!isShowLeftTree">
      <img src="@/assets/images/leftTree-hide.png" alt="" v-else>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  components: {
  },
  props: {
    isShowLeftTree: {
      type: Boolean,
      default: () => {}
    },
    treeData: {
      type: Array,
      default: () => {}
    }
  },
  data () {
    return {
    }
  },
  created () {},
  mounted () {},
  methods: {
    // 左侧显示与隐藏事件
    treeToggle () {
      this.$emit('update:isShowLeftTree', !this.isShowLeftTree)
    }
  }
}
</script>

<style lang="less" scoped>
.left-tree {
  float: left;
  width: 18%;
  height: 100%;
  background: #FFF;
  border: 1px solid #e8e8e8;
  border-right: none;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
  .treeTitle {
    height: 48px;
    line-height: 48px;
    text-align: center;
    font-size: 16px;
    color: #666;
    background-color: #F5F7FA;
    border-bottom: 1px solid #E4E7ED;
  }
  .treeNode {
    overflow: auto;
    flex: 1;
    padding: 10px;
  }
  .handle {
    position: absolute;
    right: -18px;
    top: 50%;
    margin-top: -32px;
    z-index: 100;
    cursor: pointer;
  }
}
</style>
